package org.rc.model;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Id;

/**
 * A results file. Containing results, pointing to a blobstore item.
 * 
 * @author dokeeffe
 */
public class ResultsFile implements Serializable {

    private static final long serialVersionUID = 1L;

    @Id
    private Long id;
    
    private Boolean processed;

    private Long racesProcessed;

    private Long resultsProcessed;

    private Long athletesProcessed;

    private String blobKey;

    private String name;

    private Date dateUploaded = new Date();

    private String errors;

    private Long processTime;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    /**
     * @return the processed
     */
    public Boolean getProcessed() {
        return processed;
    }

    /**
     * @param processed the processed to set
     */
    public void setProcessed(Boolean processed) {
        this.processed = processed;
    }

    /**
     * @return the blobKey
     */
    public String getBlobKey() {
        return blobKey;
    }

    /**
     * @param blobKey the blobKey to set
     */
    public void setBlobKey(String blobKey) {
        this.blobKey = blobKey;
    }

    /**
     * @return the racesProcessed
     */
    public Long getRacesProcessed() {
        return racesProcessed;
    }

    /**
     * @param racesProcessed the racesProcessed to set
     */
    public void setRacesProcessed(Long racesProcessed) {
        this.racesProcessed = racesProcessed;
    }

    /**
     * @return the resultsProcessed
     */
    public Long getResultsProcessed() {
        return resultsProcessed;
    }

    /**
     * @param resultsProcessed the resultsProcessed to set
     */
    public void setResultsProcessed(Long resultsProcessed) {
        this.resultsProcessed = resultsProcessed;
    }

    /**
     * @return the athletesProcessed
     */
    public Long getAthletesProcessed() {
        return athletesProcessed;
    }

    /**
     * @param athletesProcessed the athletesProcessed to set
     */
    public void setAthletesProcessed(Long athletesProcessed) {
        this.athletesProcessed = athletesProcessed;
    }

    public void incrementAthleteCounter() {
        if(this.athletesProcessed==null) {
            this.athletesProcessed = new Long(0);
        }
        this.athletesProcessed++;

    }

    public void incrementResultCounter() {
        if(this.resultsProcessed==null) {
            this.resultsProcessed = new Long(0);
        }
        this.resultsProcessed++;
    }

    public void incrementRaceCounter() {
        if(this.racesProcessed==null) {
            this.racesProcessed = new Long(0);
        }
        this.racesProcessed++;
    }

    /**
     * @return the name
     */
    public String getName() {
        return name;
    }

    /**
     * @param name the name to set
     */
    public void setName(String name) {
        this.name = name;
    }

    /**
     * @return the dateUploaded
     */
    public Date getDateUploaded() {
        return dateUploaded;
    }

    /**
     * @param dateUploaded the dateUploaded to set
     */
    public void setDateUploaded(Date dateUploaded) {
        this.dateUploaded = dateUploaded;
    }

    /**
     * @return the processTime
     */
    public Long getProcessTime() {
        return processTime;
    }

    /**
     * @param processTime the processTime to set
     */
    public void setProcessTime(Long processTime) {
        this.processTime = processTime;
    }

    /**
     * @return the errors
     */
    public String getErrors() {
        return errors;
    }

    /**
     * @param errors the errors to set
     */
    public void setErrors(String errors) {
        this.errors = errors;
    }

}
